/* General Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  display: flex;
  min-height: 100vh;
  background-color: #f4f7f6; /* Slightly softer background */
}

/* Sidebar Styles */
.sidebar {
  width: 250px;
  background-color: #34495e; /* Dark blue-grey */
  color: #ecf0f1; /* Light grey text */
  padding-top: 20px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid #4a6278; /* Slightly darker border */
  text-align: center;
}

.sidebar-header h2 {
  font-size: 1.4rem; /* Slightly larger */
  margin-bottom: 5px;
  color: #ffffff;
}

.sidebar-header p {
    font-size: 0.9rem;
    color: #bdc3c7; /* Lighter grey for subtitle */
}

.sidebar-menu {
  list-style: none;
  margin-top: 20px;
  flex-grow: 1; /* Allow menu to fill space */
}

.sidebar-menu li {
  padding: 15px 20px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  border-left: 4px solid transparent; /* For active state indicator */
}

.sidebar-menu li:hover {
  background-color: #4a6278; /* Hover background */
}

.sidebar-menu li.active {
  background-color: #2980b9; /* Active background - blue */
  border-left: 4px solid #3498db; /* Active border */
  color: #ffffff;
}
.sidebar-menu li.active i {
  color: #ffffff; /* Keep icon white */
}


.sidebar-menu li i {
  margin-right: 12px; /* Icon spacing */
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  color: #bdc3c7; /* Default icon color */
  transition: color 0.2s ease-in-out;
}
.sidebar-menu li:hover i {
    color: #ecf0f1; /* Icon color on hover */
}


/* Content Area Styles */
.content {
  flex: 1;
  padding: 25px; /* More padding */
  overflow-y: auto;
  background-color: #ffffff; /* White content background */
}

/* Panel Styles */
.panel {
  background-color: #ffffff;
  border-radius: 8px; /* More rounded corners */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Softer shadow */
  padding: 25px;
  margin-bottom: 25px;
  border: 1px solid #e0e0e0; /* Light border */
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eeeeee;
}

.panel-header h2 {
  font-size: 1.6rem; /* Larger panel titles */
  color: #34495e; /* Match sidebar color */
  font-weight: 600;
}

/* Search Bar Styles */
.search-bar {
  display: flex;
  margin-bottom: 20px;
}

.search-bar input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ccc;
  border-radius: 4px 0 0 4px;
  font-size: 1rem;
  transition: border-color 0.3s;
}
.search-bar input:focus {
  outline: none;
  border-color: #3498db; /* Blue focus border */
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}


.search-bar button {
  padding: 10px 15px; /* Adjust padding */
  background-color: #3498db; /* Blue */
  color: white;
  border: none;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: background-color 0.3s;
  font-size: 1rem; /* Match input */
  display: flex;
  align-items: center;
  gap: 5px; /* Space between icon and text if any */
}

.search-bar button:hover {
  background-color: #2980b9; /* Darker blue */
}

/* Data Table Styles */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px; /* Space below table */
}

.data-table th,
.data-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #e0e0e0; /* Lighter border */
  text-align: left;
  vertical-align: middle; /* Align content vertically */
}

.data-table th {
  background-color: #f8f9fa; /* Very light grey */
  color: #555; /* Darker grey text */
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase; /* Uppercase headers */
  letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
  background-color: #f1f5f8; /* Subtle hover effect */
}

.data-table td {
    color: #333;
    font-size: 0.95rem;
}

/* Action Buttons in Table */
.data-table .action-buttons {
  display: flex;
  gap: 8px; /* Space between action buttons */
  white-space: nowrap; /* Prevent wrapping */
}

.data-table .icon-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
  line-height: 1; /* Ensure icon is centered */
}

.data-table .edit-button { color: #3498db; /* Blue */ }
.data-table .edit-button:hover { background-color: rgba(52, 152, 219, 0.1); color: #2980b9; }

.data-table .delete-button { color: #e74c3c; /* Red */ }
.data-table .delete-button:hover { background-color: rgba(231, 76, 60, 0.1); color: #c0392b; }

.data-table .edit-button:disabled,
.data-table .delete-button:disabled {
    color: #bdc3c7; /* Disabled color */
    cursor: not-allowed;
}
.data-table .edit-button:disabled:hover,
.data-table .delete-button:disabled:hover {
    background-color: transparent;
}


/* General Button Styles */
.button {
  padding: 10px 18px; /* More padding */
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  margin: 2px;
  white-space: nowrap;
  display: inline-flex; /* Align icon and text */
  align-items: center;
  gap: 6px; /* Space between icon and text */
}
.button i {
    font-size: 1em; /* Match button text size */
}

.button-primary { background-color: #3498db; color: white; }
.button-primary:hover { background-color: #2980b9; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.button-danger { background-color: #e74c3c; color: white; }
.button-danger:hover { background-color: #c0392b; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.button-success { background-color: #2ecc71; color: white; }
.button-success:hover { background-color: #27ae60; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

/* Collapsible Box for Forms */
.collapse-box {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, padding 0.4s ease-out, margin 0.4s ease-out;
  margin-top: 0;
  padding: 0 15px;
  border: 1px solid transparent; /* Prepare for border */
  border-radius: 4px;
}

.collapse-box.open {
  max-height: 800px; /* Adjust if form is very tall */
  overflow: visible;
  transition: max-height 0.5s ease-in, padding 0.5s ease-in, margin 0.5s ease-in;
  margin-top: 20px;
  padding: 20px 15px; /* Add padding when open */
  border: 1px solid #ddd;
  background-color: #f8f9fa; /* Light background for form area */
}

/* Edit Form Styles */
.edit-form h3 {
    font-size: 1.3rem;
    color: #34495e;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.edit-form label {
  display: block;
  margin-bottom: 6px; /* Spacing */
  font-weight: 600;
  color: #555;
  font-size: 0.9rem;
}

.edit-form input[type="text"],
.edit-form input[type="password"],
.edit-form input[type="date"],
.edit-form input[type="number"],
.edit-form select,
.edit-form textarea {
  width: 100%;
  padding: 10px 12px; /* Input padding */
  margin-bottom: 18px; /* Input spacing */
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.edit-form input:focus,
.edit-form select:focus,
.edit-form textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.edit-form textarea {
  min-height: 80px;
  resize: vertical;
}

.edit-form .action-buttons {
  margin-top: 15px;
  display: flex;
  justify-content: flex-end; /* Align buttons to the right */
  gap: 10px; /* Space between form buttons */
}

/* Add Row Button */
.add-row-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background-color: #e9ecef;
  border: 1px dashed #ccc;
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s ease;
  color: #34495e; /* Darker text */
  font-weight: 500;
}

.add-row-btn:hover {
  background-color: #dcdfe4;
  border-color: #bbb;
}

.add-row-btn i {
  margin-right: 8px;
}

/* Tab Content Visibility */
.tab-content:not(.active) {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.5s ease-in-out; /* Fade in animation */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Message Area Styling (Optional) */
.message-area {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateX(20px);
    animation: slideInFadeOut 5s forwards; /* 5s total duration */
}

.message.success { background-color: #2ecc71; } /* Green */
.message.error { background-color: #e74c3c; } /* Red */
.message.info { background-color: #3498db; } /* Blue */

@keyframes slideInFadeOut {
    0% { opacity: 0; transform: translateX(20px); }
    10% { opacity: 1; transform: translateX(0); } /* Fade in fast */
    90% { opacity: 1; transform: translateX(0); } /* Stay visible */
    100% { opacity: 0; transform: translateX(20px); } /* Fade out */
}

/* Loading state */
.loading {
    opacity: 0.7;
    pointer-events: none; /* Prevent interaction while loading */
}